// 使用webpack处理跨域问题并将axios注册到vue中
// 可以在组件中使用this.axios调用

const VueAxios = {
    vm: {},
    install (Vue, instance) {
        if (this.installed) {
            return
        }
        this.installed = true

        if (!instance) {
            console.error('You have to install axios')
            return
        }

        Vue.axios = instance

        Object.defineProperties(Vue.prototype, {
            axios: {
                get: function () {
                    return instance
                }
            }
        })
    }
}

export {
    VueAxios
}